<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <input type="text" id="username">
    <input type="text" id="password">

    <script>
        var username = document.getElementById("username");
        username.oninput = function(e){
            console.log(e.target.value);
        }

        username.onselect = function(e){
            console.log('选中了');
        }

        var password = document.getElementById("password");
        password.onchange = function(e){
            console.log('内容改变了');
        }

    </script>
</body>
</html>